var app = getApp();
var iFDU = require('../../utils/iFDU.js');
Page({
  data: {
    config: app.config,
    globalData: app.globalData,

    deliverCompany: '',
    deliverCompanyName: '',
    deliverOrderId: '',
    expressInfoList: []
  },

  onLoad: function (options) {
    this.setData({
      deliverCompany: options.deliverCompany,
      deliverOrderId: options.deliverOrderId
    });
  },

  onShow: function () {
    var that = this;
    app.getUserInfo(function (globalData) {
      that.setData({
        globalData: globalData
      });

      iFDU.api.doGet(
        'delivery/getDeliveryInfo',
        {
          userId: globalData.userId,
          deliverCompany: that.data.deliverCompany,
          deliverOrderId: that.data.deliverOrderId

        },
        function (data) {
          that.setData({
            deliverCompanyName: data.deliverCompanyName,
            expressInfoList: data.traces
          });
        }
      );
    });
  },

  onShareAppMessage: function (res) {
    var that = this;
    return {
      title: '不以优惠为目的的充值，都是耍流氓…',
      imageUrl: 'http://s.i-fdu.com/runto/wxa/s/yjshare.jpeg',
      path: 'pages/home/home',
      success: function (res) {
      },
      fail: function (res) {
      }
    }
  }
})